package com.jyy.prefabricated.controller;

import com.jyy.prefabricated.common.AjaxResult;
import com.jyy.prefabricated.dto.UmsEnterPriseInfoVo;
import com.jyy.prefabricated.service.QichachaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 企查查查询企业信息
 * @version 1.0.0
 */

@Slf4j
@RequestMapping("/api")
@RestController
public class EnterpriseInfoController {

    @Autowired
    private QichachaService qichachaService;

    /**
     * 查询企业信息
     * @param enterName
     * @return
     */
    @RequestMapping(value = "/enterprise-info",method = RequestMethod.GET)
    @ResponseBody
    public AjaxResult getEnterPriseInfo(String enterName) {
        UmsEnterPriseInfoVo result = qichachaService.getTaxResult(enterName);
        if (result != null) {
            return AjaxResult.success(result);
        } else {
            return AjaxResult.error("找不到相关信息");
        }
    }
}
